<?php

use yii\db\Migration;

class m160512_081525_updateTable_doctor extends Migration
{
    /**
     * 保存省市区，使用jquery插件，直接保存的字符串形式
     */
    const TBL_NAME = '{{%doctor}}';
    public function up()
    {
        $sql = "ALTER TABLE ".self::TBL_NAME."
            ADD COLUMN `province`  char(2) NULL COMMENT '省' AFTER `follow_numbers`,
            ADD COLUMN `city`  char(2) NULL COMMENT '市' AFTER `province`,
            ADD COLUMN `area`  char(2) NULL COMMENT '区' AFTER `city`;";

        $this->execute($sql);
    }

    public function down()
    {
        echo "m160512_081525_updateTable_doctor cannot be reverted.\n";

        return false;
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
